<?php

use think\facade\Queue;

if (!function_exists('queue')) {
    /**
     * 添加到队列
     * @param $job
     * @param string $data
     * @param int $delay
     * @param null $queue
     * @return mixed
     */
    function queue($job, $data = '', $delay = 0, $queue = null)
    {
        if ($delay > 0) {
            return Queue::later($delay, $job, $data, $queue);
        } else {
            return Queue::push($job, $data, $queue);
        }
    }
}
